<?php
include("../connection/connection.php");
include("reportFunctions.php");
$distId=$_REQUEST['distId'];
$sqlReport = "SELECT distinct `district_id`,`district_name`,`block_id`,`block_name` FROM `tbl_lookup_location` where `district_id` = ".$distId." group by `block_id`";
$queryReport = mysql_query($sqlReport);
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Block</title>
</head>
<body>
<table border="0" width="900" cellspacing="0" cellpadding="0">
	<tr>
		<td bgcolor="#E9E9E9" height="26">
		<p align="center"><span style="font-size: 9pt; font-weight: 700">
		<font face="Verdana" color="#224568">Block wise Operation and Maintenance cost for hand pumps (as per PHED)</font></span></td></tr>
		 <tr><td bgcolor="#E9E9E9" height="26"><div align="center"><font face="Verdana" style="font-size: 9pt; font-weight: 700" color="#224568">Table 26 </font></div></td>
	</tr>
	<tr>
		<td bgcolor="#E9E9E9" height="56">
		<table border="1" width="900" cellspacing="0" cellpadding="0" height="47" bgcolor="#C5D8EB">
			<tr>
				<td width="80" align="center">
				<font style="font-size: 8.5pt" face="Verdana">District</font></td>
				<td width="80" align="center">
				<font style="font-size: 8.5pt" face="Verdana">Block</font></td>
				<td width="41" align="center">
				<p align="center"><font face="Verdana" style="font-size: 8.5pt">
				Man Power cost/annum (Rs.)</font></td>
				<td width="60" align="center">
				<font style="font-size: 8.5pt" face="Verdana">Material cost/annum (Rs.)</font></td>
				<td width="70" align="center">
				<font style="font-size: 8.5pt" face="Verdana">Total O&M cost/annum (Rs.)</font></td>
				<td width="60" align="center">
				<font face="Verdana" style="font-size: 8.5pt">Total No. of HP</font></td>
				<td width="60" align="center">
				<font face="Verdana" style="font-size: 8.5pt">Manpower cost/HP/annum (Rs.)</font></td>
				<td width="60" align="center">
				<font face="Verdana" style="font-size: 8.5pt">Material cost/HP/annum (Rs.)</font></td>
				<td width="60" align="center">
				<font face="Verdana" style="font-size: 8.5pt">Total O&M cost/HP/annum (Rs.)</font></td>
				
				
			</tr>
			<?php
			//$numVillage=0;
			//$numFormVill=0;
			while($rowReport = mysql_fetch_array($queryReport)) {
			?><tr bgcolor="#FFFFFF">
				
				<td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReport['district_name'];?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $rowReport['block_name'];?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php 
				$a=number_format(getManPowerBlockWise($rowReport['block_id'],'manpower_cost_09_10'),2,'.','');
				if($a=='')
				{
					echo 0;
				}
				else
				{
					echo $a;
				}
				?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php 
				$b=number_format(getManPowerBlockWise($rowReport['block_id'],'material_cost_09_10'),2,'.','');
				if($b=='')
				{
					echo 0;
				}
				else
				{
					echo $b;
				}
				?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php 
				$c=number_format(getOMPowerBlockWise($rowReport['block_id'],'manpower_cost_09_10','material_cost_09_10'),2,'.','');
				if($c=='')
				{
					echo 0;
				}
				else
				{
					echo $c;
				}
				?></font></td>
				<td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $total_hp=getTotalHP($rowReport['block_name'],$distId);?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo getManDevideHP($distId,$rowReport['block_name'],$rowReport['block_id'],'manpower_cost_09_10');?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo getManDevideHP($distId,$rowReport['block_name'],$rowReport['block_id'],'material_cost_09_10');?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo getOManDevideHP($distId,$rowReport['block_name'],$rowReport['block_id'],'manpower_cost_09_10','material_cost_09_10');?></font></td>
				
				
			</tr>
			<?php
			$tot_sum_man_power+=$a;
			$tot_sum_material+=$b;
			$tot_sum_om+=$c;
			$total_hp1+=$total_hp;
			}
			?>
			<tr bgcolor="#E9E9E9">
				<td width="" align="center"><font face="Verdana" style="font-size: 8.5pt">Total</font></td>
				<td width="" align="center"><font face="Verdana" style="font-size: 8.5pt">&nbsp;</font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $tot_sum_man_power;?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $tot_sum_material;?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php echo $tot_sum_om;?></font></td>
				<td width="" align="center"><font face="Verdana" style="font-size: 8.5pt"><?php echo $total_hp1;//getSumTotalHP($distId);?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php //echo getSumManDevideHP($distId,'manpower_cost_09_10');
				if($total_hp1==0)
				{
				echo "0.00";
				}else{
				echo number_format(($tot_sum_man_power/$total_hp1),2,'.','');}
				
				?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php //echo getSumManDevideHP($distId,'material_cost_09_10');
				if($total_hp1==0)
				{
				echo "0.00";
				}else{
				echo number_format(($tot_sum_material/$total_hp1),2,'.','');}
				
				?></font></td>
				<td align="center" width=""><font face="Verdana" style="font-size: 8.5pt"><?php //echo getSumOManDevideHP($distId,'manpower_cost_09_10','material_cost_09_10');
				if($total_hp1==0)
				{
				echo "0.00";
				}else{
				echo number_format(($tot_sum_om/$total_hp1),2,'.','');}
				
				?></font></td>
				
				
			</tr>

			
		</table>
		</td>
	</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>


</body>

</html>